package org.osprey.apidoc.service;

import io.reactivex.rxjava3.core.Single;
import io.vertx.codegen.annotations.Fluent;
import io.vertx.codegen.annotations.ProxyGen;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import org.osprey.apidoc.pojo.User;

import java.util.Map;

/**
 * @ClassName UserService
 * @Description: 用户Service
 * @Author Osprey
 * @Date 2019/10/15
 * @Version V2.0
 **/
@VertxGen
@ProxyGen
public interface UserService {

    /**
     * 添加用户
     * @param paramUser
     * @return
     */
    Integer addUser(User paramUser);

    /**
     * 根据用户名获得用户
     * @param userName
     * @return
     */
    @Fluent
    UserService getUserByUserName(String userName, Handler<AsyncResult<User>> resultHandler);

    /**
     * 用户登录业务
     * @param userName
     * @param password
     * @param resultHandler
     * @return
     */
    @Fluent
    UserService login(String userName, String password, Handler<AsyncResult<Map<String, Object>>> resultHandler);

    /**
     * 密码修改
     * @param userName
     * @param oldPassword
     * @param newPassword
     * @return
     */
    boolean changePassword(String userName, String oldPassword, String newPassword);

    /**
     * 用户修改昵称
     * @param userId
     * @param nickName
     * @return
     */
    boolean changeNickName(Integer userId, String nickName);

    /**
     * 用户信息
     * @param userId
     * @return
     */
    Map<String, Object> getUserInfo(Integer userId);
}
